package com.bigshen.demo.annotation.configurecomponents.a1ComponentScan;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

@Configuration
//1. 简单使用ComponentScan注解扫描，扫描包下的bean使用@Service、@Controller、@Component等注解配合，可以扫描到
//@ComponentScan(value = "com.bigshen.demo.project")
//2. useDefaultFilters = false， 不使用Spring默认的扫描filter，
//  自己指定扫描规则
@ComponentScan(
        value = "com.bigshen.demo.project",

        useDefaultFilters = false,
        includeFilters = {
//                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class),  // 使用注解扫描
//                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = MyDao.class),     // 直接制定类型扫描
                @ComponentScan.Filter(type = FilterType.CUSTOM, value = MatchedFilter.class)},     // 直接自定义类型扫描
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.CUSTOM, value = UnMatchedFilter.class)   // 直接自定义类型排除
        }
        )
public class MyConfig {


}
